package com.example.ui.service.feign;

import com.example.ui.pojo.Person;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 使用feign调用producer服务
 *
 * @author 86188
 */
@FeignClient(name = "producer",fallback = ProducerServiceFallBack.class)
public interface ProducerService {

    @RequestMapping(value = "/save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
    @ResponseBody
    List<Person> save(@RequestBody String name);

    @RequestMapping(value = "/list")
    @ResponseBody
    List<Person> list();

    @RequestMapping("/hello")
    String hello(@RequestParam("name") String name);
}
